<?php

require_once 'PipesImpl/Renderable.php';

class Pipes_Form_Container
{
    private $_action = '';
    private $_elements = array();
    
    public function action($action)
    {
        $this->_action = $action;
        return $this;
    }
    
    public function add(PipesImpl_Renderable $element)
    {
        $this->_elements[] = $element;
        return $this;
    }
    
    public function render()
    {
        $return = "<form action=\"{$this->_action}\" method=\"post\">\n";
        foreach ($this->_elements as $element) {
            $return .= $element->render() . "\n";
        }
        $return .= '</form>';
        return $return;
    }
}

